home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue26 / keytrap / DCompose.dpr < prev    next >
Encoding:
Text File  |  1997-07-17  |  1.2 KB  |  44 lines

  1. program dcompose;
  2.  
  3. uses
  4. {$IFDEF Ver90}
  5.   { This unit sets the global variable IsLibrary to true at
  6.     the outset; this suppresses the creation of the Application.Handle
  7.     and thus supresses the icon on the task bar.  Set IsLibrary back
  8.     to false at earliest opportunity in source below. Not needed under
  9.     Delphi 3, which supresses icon itself somehow. (it probably does
  10.     this by either not incuding WS_VISIBLE in the CreateWindow call,
  11.     or by not showing the window with ShowWinNoAnimate; compare
  12.     Application.CreateHandle for D2 and D3)
  13.     However, see notes in TDCompForm.AppOnMessage
  14.     about the difference in where the message broadcast to toplevel
  15.     windows from the DLL will wind up.}
  16.   RunFirst in 'RunFirst.pas',
  17. {$ENDIF}
  18.   Forms,
  19.   Windows,
  20.   dcompfrm in 'DCompfrm.PAS' {DCompForm}; {DCompForm}
  21.  
  22. {$R *.RES}
  23.  
  24. const
  25.   MutexName = 'Run only one DCompose';
  26.  
  27. var
  28.   MyMutex : THandle;
  29.  
  30. begin
  31. {$IFDEF Ver90}
  32.   IsLibrary := False;
  33. {$ENDIF}
  34.  
  35.   MyMutex := CreateMutex(nil,true,MutexName);
  36.   if (MyMutex = 0) or (GetLastError = ERROR_ALREADY_EXISTS) then
  37.     Halt;
  38.   Application.ShowMainForm := False;
  39.   Application.CreateForm(TDCompForm, DCompForm);
  40.   Application.Run;
  41.   CloseHandle(MyMutex);
  42. end.
  43.  
  44.